package com.product.utils;

import com.product.service.IInspectorCordsService;
import com.product.to.AddInspectorCordTo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import static java.lang.Thread.sleep;

@Service
public class DefectTestService {
    @Autowired
    private IInspectorCordsService inspectorCordsService;

    @Async
    public void defectImg(String fileName, Integer lineId) throws InterruptedException {
        for (int i = 6; i < 67; i++) {
            AddInspectorCordTo cordTo = new AddInspectorCordTo(lineId, String.format("%s_%d.jpg", fileName, i));
            inspectorCordsService.addInspectorCords(cordTo);
            sleep(150);
        }
    }
}
